var a,
  t = require("../../@babel/runtime/helpers/defineProperty"),
  e = require("../../res/www.a9a.cn.js"),
  i = getApp(),
  s = "mate_";
Page({
  data: {
    div_login_ys: !1,
    kefushow: !1,
    form_agree_reg: 1,
    form_agree_wxshare: 1,
    FORMDATA: { mob: "" },
    FORMDATA_MATE: {},
    PARR: [],
    ifwin: !0,
    yzmbtnFlag: "send",
    sms_yzmnum_tmp: 0,
    tguid: 0,
    admid: 0,
    div_in_aboutus: !1,
    mask_class: "alpha0_100",
    areaidARR: [],
    areaidARRDEF: [],
    areaidIdx: [],
    area2idARR: [],
    area2idARRDEF: [],
    area2idIdx: [],
    checkboxvalue: [],
    ifmate: !1,
    ifregsuccess: !1,
  },
  onLoad: function (a) {
    var t = this,
      s = 0,
      o = 0,
      d = 0;
    if (
      (i.get_config("_ZEAI").then(function (a) {
        t.setData({ color: i._ZEAI.color, rgbcolor: e.c16_rgb(i._ZEAI.color) });
      }),
      e.ifint(a.fid))
    )
      (s = e.ifint(a.fid) ? a.fid : 0),
        (o = e.ifint(a.tguid) ? a.tguid : 0),
        (d = e.ifint(a.admid) ? a.admid : 0);
    else {
      for (
        var n = decodeURIComponent(a.scene), r = {}, c = 0;
        c < n.split("*").length;
        c++
      ) {
        var u = n.split("*")[c].split("/");
        r[u[0]] = u[1];
      }
      (s = e.ifint(r.f) ? r.f : 0),
        (d = e.ifint(r.a) ? r.a : 0),
        (o = e.ifint(r.t) ? r.t : 0);
    }
    this.setData({ fid: s, tguid: o, admid: d }),
      i.get_openid().then(function (a) {
        t.init();
      }),
      i.get_navigationBarTopHeight(t);
  },
  init: function () {
    var t = this;
    e.ifint(this.data.fid) ||
      wx.showModal({
        content: "参数跑路了",
        confirmColor: t.data.color,
        confirmText: "朕知道了",
        showCancel: !1,
        success: function (a) {
          wx.navigateBack();
        },
      }),
      wx.showLoading({ title: "玩命加载中...", mask: !0 }),
      (a = wx.getStorageSync("COOK_U")),
      i.ajax({
        url: "form.php",
        data: { submitok: "form_detail", openid: a.openid, fid: t.data.fid },
        success: function (a) {
          if (1 == a.flag) {
            var i = e.escape2Html(a.D.content);
            t.setData({
              ifphoto_s: a.ifphoto_s,
              upMaxMB: a.upMaxMB,
              ifzoyq: a.D.ifzoyq,
              D: a.D,
              mbbgcolor_rgb: e.c16_rgb(a.D.mbbgcolor),
              SHARE: a.SHARE,
              content: i,
              D_basic: a.D_basic,
              D_mate: a.D_mate,
              _UDATA: a._UDATA,
              sms_yzmnum: a.sms_yzmnum,
              s: a.s,
              arealeval: a.arealeval,
              areaidARR: a.areaidARR,
              areaidARRDEF: a.areaidARR.ARRDEF,
              areaidIdx: a.areaidARR.Idx,
              area2idARR: a.area2idARR,
              area2idARRDEF: a.area2idARR.ARRDEF,
              area2idIdx: a.area2idARR.Idx,
            }),
              wx.setNavigationBarTitle({ title: a.D.title });
          } else wx.showToast({ title: a.msg, icon: "none", mask: !0 });
          wx.hideLoading();
        },
      });
  },
  bm_addFn: function () {
    var t = this;
    i.ajax({
      url: "form.php",
      data: { submitok: "bm_add", openid: a.openid, fid: t.data.fid },
      success: function (s) {
        1 == s.flag
          ? t.setData({ div_bm_add: !0, U: s.U })
          : "pay" == s.flag
          ? 1 == s.ifpay &&
            wx.showModal({
              title: "",
              content: s.msg,
              confirmColor: t.data.color,
              cancelText: "取消",
              confirmText: "联系支付",
              success: function (s) {
                s.confirm &&
                  (1 != t.data.ios_ifpay.flag
                    ? wx.getSystemInfo({
                        success: function (a) {
                          wx.navigateTo({ url: "../about/about" });
                        },
                      })
                    : i.pay({
                        data: {
                          submitok: "party_bm",
                          openid: a.openid,
                          fid: t.data.fid,
                        },
                        success: function () {
                          t.init();
                        },
                        fail: function (a) {
                          (a.this = t), (a.url = "no"), e.sorry(a);
                        },
                      }));
              },
            })
          : ((s.this = t), (s.url = "no"), e.sorry(s));
      },
    });
  },
  div_bm_add_submitFn: function (t) {
    var s = this,
      o = t.detail.value;
    i.empty(o.sex)
      ? wx.showToast({ title: "请选择【性别】", icon: "none", mask: !0 })
      : i.ifmob(o.mob)
      ? i.ifweixin(o.weixin)
        ? i.empty(o.truename)
          ? wx.showToast({ title: "请输入【姓名】", icon: "none", mask: !0 })
          : !i.empty(o.birthday) && e.ifint(o.birthday)
          ? wx.showModal({
              title: "",
              content: "确定信息无误提交报名么？",
              confirmColor: s.data.color,
              cancelText: "取消",
              confirmText: "确定",
              success: function (t) {
                t.confirm &&
                  (wx.showLoading({ title: "正在提交", mask: !0 }),
                  i.ajax({
                    url: "form.php",
                    data: {
                      submitok: "bm_add_update",
                      openid: a.openid,
                      fid: s.data.fid,
                      sex: o.sex,
                      weixin: o.weixin,
                      mob: o.mob,
                      truename: o.truename,
                      birthday: o.birthday,
                    },
                    success: function (a) {
                      wx.hideLoading(),
                        1 == a.flag
                          ? wx.showModal({
                              content: a.msg,
                              confirmColor: s.data.color,
                              confirmText: "朕知道了",
                              showCancel: !1,
                              success: function (t) {
                                s.setData({ div_bm_add: !1 }),
                                  1 == a.ifpay
                                    ? wx.showModal({
                                        title: "",
                                        content: a.ifpay_str,
                                        confirmColor: s.data.color,
                                        cancelText: "稍后支付",
                                        confirmText: "联系支付",
                                        success: function (a) {
                                          a.confirm
                                            ? wx.navigateTo({
                                                url: "../about/about",
                                              })
                                            : s.init();
                                        },
                                      })
                                    : s.init();
                              },
                            })
                          : ((a.this = s), (a.url = "no"), e.sorry(a));
                    },
                  }));
              },
            })
          : wx.showToast({ title: "请输入【生年】", icon: "none", mask: !0 })
        : wx.showToast({ title: "请输入【微信】", icon: "none", mask: !0 })
      : wx.showToast({ title: "请输入【手机】", icon: "none", mask: !0 });
  },
  mask_closeFn: function (a) {
    var e = this,
      i = a.currentTarget.dataset.maskid;
    this.setData({ mask_class: "alpha100_0" }),
      setTimeout(function () {
        var a;
        e.setData((t((a = {}), i, !1), t(a, "mask_class", "alpha0_100"), a));
      }, 500);
  },
  bbs_btnFn: function () {
    var a = this;
    i.chklogin().then(function (t) {
      t ? a.setData({ div_bbs: !0 }) : wx.navigateTo({ url: "../login/login" });
    });
  },
  getPhoneNumber: function (a) {
    i.getPhoneNumber({
      e: a,
      url: "/pages/form/form_detail?id=" + this.data.fid,
    });
  },
  getmobFn: function (e) {
    var s = this;
    wx.login({
      success: function (o) {
        wx.request({
          url: i.WWW + "/api/wxxcx/get_openid.php",
          data: { code: o.code },
          success: function (o) {
            (o = i.jsoneval(o.data)),
              (a = wx.getStorageSync("COOK_U")),
              wx.request({
                url: i.WWW + "/api/wxxcx/get_mob.php",
                data: {
                  session_key: encodeURIComponent(o.U.session_key),
                  encryptedData: encodeURIComponent(e.detail.encryptedData),
                  iv: encodeURIComponent(e.detail.iv),
                  openid: o.U.openid,
                  submitok: "getmob",
                },
                success: function (a) {
                  (a = i.jsoneval(a.data)),
                    console.log(a),
                    i.ifmob(a.mob)
                      ? s.setData(t({}, "FORMDATA.mob", a.mob))
                      : (s.setData({ div_login: !0 }), console.log("mob为空"));
                },
                fail: function (a) {
                  wx.showModal({ content: a, showCancel: !1 });
                },
              });
          },
        });
      },
    });
  },
  ysFn: function () {
    this.setData({ div_login_ys: !1 });
  },
  back: function () {
    wx.navigateBack();
  },
  onPageScroll: function (a) {
    a.scrollTop > 400
      ? this.setData({ backtop_flag: !0 })
      : this.setData({ backtop_flag: !1 });
  },
  backtopFn: function (a) {
    wx.pageScrollTo({ scrollTop: 0, duration: 300 });
  },
  birthdayFn: function (a) {
    var e,
      i = a.detail.value,
      s = a.currentTarget.dataset.f,
      o = a.currentTarget.dataset.idx;
    this.setData(
      (t((e = {}), "FORMDATA." + s, i), t(e, "D_basic[" + o + "].v", i), e)
    );
  },
  Ffn1_basic: function (a) {
    var e,
      s = a.currentTarget.dataset.f,
      o = a.detail.value,
      d = a.currentTarget.dataset.idx;
    "mob" != s ||
      i.ifmob(o) ||
      wx.showToast({ title: "请输入正确的【手机号】", icon: "none", mask: !0 }),
      this.setData(
        (t((e = {}), "FORMDATA." + s, o), t(e, "D_basic[" + d + "].v", o), e)
      );
  },
  agree_regFn: function (a) {
    var t = a.detail.value;
    (t = t ? 1 : 0), this.setData({ form_agree_reg: t });
  },
  agree_wxshareFn: function (a) {
    var t = a.detail.value;
    (t = t ? 1 : 0), this.setData({ form_agree_wxshare: t });
  },
  aboutusFn: function (a) {
    var t = this;
    t.setData({ div_in_aboutus: !0 }),
      setTimeout(function () {
        t.setData({ if_aboutus_focus: !0 });
      }, 500);
  },
  mate_otherFn: function (a) {
    var t = this;
    t.setData({ div_in_mate_other: !0 }),
      setTimeout(function () {
        t.setData({ if_mate_other_focus: !0 });
      }, 500);
  },
  div_in_aboutus_closeFn: function () {
    this.setData({ div_in_aboutus: !1 });
  },
  div_in_mate_other_closeFn: function () {
    this.setData({ div_in_mate_other: !1 });
  },
  aboutus_submitFn: function (a) {
    var e,
      i = a.currentTarget.dataset.f,
      s = a.currentTarget.dataset.idx,
      o = a.detail.value.aboutus;
    this.setData(
      (t((e = {}), "FORMDATA." + i, o),
      t(e, "div_in_aboutus", !1),
      t(e, "if_aboutus_focus", !1),
      t(e, "D_basic[" + s + "].v", o),
      e)
    );
  },
  mate_other_submitFn: function (a) {
    var e,
      i = a.currentTarget.dataset.f,
      o = a.currentTarget.dataset.idx,
      d = a.detail.value.mate_other;
    this.setData(
      (t((e = {}), "FORMDATA_MATE." + s + i, d),
      t(e, "div_in_mate_other", !1),
      t(e, "if_mate_other_focus", !1),
      t(e, "D_mate[" + o + "].v", d),
      e)
    );
  },
  Ffn2_basic: function (a) {
    var e,
      i = a.detail.value,
      s = a.currentTarget.dataset.f,
      o = this.data._UDATA[s][i],
      d = a.currentTarget.dataset.idx;
    this.setData(
      (t((e = {}), "FORMDATA." + s, o.i),
      t(e, "D_basic[" + d + "].k", i),
      t(e, "D_basic[" + d + "].v", o.v),
      e)
    );
  },
  Ffn3_ext: function (a) {
    a.detail.value;
    var t = a.currentTarget.dataset.f,
      i = a.currentTarget.dataset.i,
      s = a.currentTarget.dataset.idx,
      o = e.set_checked(i, this.data._UDATA[t]);
    this.setData({
      ifmate: !1,
      if_div_bottom: !0,
      div_bottom_mask_class: "alpha0_100",
      div_bottom_box_class: "div_upAnm1",
      checkbox_F: t,
      checkbox_idx: s,
      checkbox_arr: o,
    });
  },
  checkboxChangeFn: function (a) {
    this.setData({ checkboxvalue: a.detail.value });
  },
  div_bottom_save_Fn: function (a) {
    var o = this.data.checkbox_idx,
      d = e.checkbox_div_list_get_listTitle(
        this.data.checkboxvalue,
        this.data.checkbox_arr
      ),
      n = this.data.checkboxvalue;
    if (n.length >= i.globalData.checkboxMaxNum)
      return (
        wx.showToast({
          title: "最多选择 " + i.globalData.checkboxMaxNum + " 项",
          icon: "none",
        }),
        !1
      );
    var r,
      c,
      u = e.set_checked(n, this.data.checkbox_arr);
    (this.div_bottom_close_Fn(), this.data.ifmate)
      ? this.setData(
          (t(
            (r = {}),
            "FORMDATA_MATE." + s + this.data.checkbox_F,
            n.join(",")
          ),
          t(r, "checkbox_arr", u),
          t(r, "D_mate[" + o + "].i", n.join(",")),
          t(r, "D_mate[" + o + "].v", d),
          r)
        )
      : this.setData(
          (t((c = {}), "FORMDATA." + this.data.checkbox_F, n.join(",")),
          t(c, "checkbox_arr", u),
          t(c, "D_basic[" + o + "].i", n.join(",")),
          t(c, "D_basic[" + o + "].v", d),
          c)
        );
  },
  div_bottom_close_Fn: function () {
    var a = this;
    this.setData({
      div_bottom_mask_class: "alpha100_0",
      div_bottom_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        a.setData({ if_div_bottom: !1 });
      }, 400);
  },
  div_bottom_blank_Fn: function () {},
  Ffn1_mate: function (a) {
    var e,
      i = a.currentTarget.dataset.f,
      o = a.detail.value,
      d = a.currentTarget.dataset.idx;
    this.setData(
      (t((e = {}), "FORMDATA_MATE." + s + i, o),
      t(e, "D_mate[" + d + "].v", o),
      e)
    );
  },
  Ffn2_mate: function (a) {
    var e,
      i = a.detail.value,
      o = a.currentTarget.dataset.f,
      d = this.data._UDATA[o][i],
      n = a.currentTarget.dataset.idx;
    this.setData(
      (t((e = {}), "FORMDATA_MATE." + s + o, d.i),
      t(e, "D_mate[" + n + "].k", i),
      t(e, "D_mate[" + n + "].v", d.v),
      e)
    );
  },
  Ffn3_mate: function (a) {
    a.detail.value;
    var t = a.currentTarget.dataset.f,
      i = a.currentTarget.dataset.i,
      s = a.currentTarget.dataset.idx,
      o = e.set_checked(i, this.data._UDATA[t]);
    this.setData({
      ifmate: !0,
      if_div_bottom: !0,
      div_bottom_mask_class: "alpha0_100",
      div_bottom_box_class: "div_upAnm1",
      checkbox_F: t,
      checkbox_idx: s,
      checkbox_arr: o,
    });
  },
  Ffn4_mate: function (a) {
    var i,
      o = a.currentTarget.dataset.f,
      d = a.detail.value,
      n = a.currentTarget.dataset.idx;
    if (d[0] > d[1])
      return wx.showToast({ title: "必须左小右大哦", icon: "none" }), !1;
    var r = this.data.D_mate[n].rang_ARR[0],
      c = e.idx_iv(d, r),
      u = c[0],
      f = c[1];
    this.setData(
      (t((i = {}), "FORMDATA_MATE." + s + o, u),
      t(i, "D_mate[" + n + "].rang_Idx", d),
      t(i, "D_mate[" + n + "].v", f),
      i)
    );
  },
  Ffn4_change_mate: function (a) {},
  verifyChangeFn: function (a) {
    this.setData({ verify: a.detail.value });
  },
  mobChangeFn: function (a) {
    this.setData({ mob: a.detail.value });
  },
  verifyFn: function (t) {
    var s = t.currentTarget.dataset.mob,
      o = this;
    o.data.sms_yzmnum_tmp >= o.data.sms_yzmnum && o.data.sms_yzmnum > 0
      ? wx.showToast({
          title: "重复发送过多暂停发送",
          icon: "fail",
          mask: !0,
          duration: 5e3,
        })
      : i.empty(s)
      ? wx.showToast({ title: "请输入【手机号】", icon: "none", mask: !0 })
      : i.ifmob(s)
      ? i.ifmob(s) &&
        ((a = wx.getStorageSync("COOK_U")),
        i.ajax({
          url: "form.php",
          data: {
            submitok: "verify_get",
            mob: s,
            openid: a.openid,
            fid: o.data.fid,
          },
          success: function (a) {
            console.log(a.verify),
              1 == a.flag
                ? (wx.showToast({
                    title: a.msg,
                    icon: "success",
                    mask: !0,
                    duration: 4e3,
                  }),
                  o.yzmtimeFn2(o.data.s),
                  o.setData({
                    sms_yzmnum_tmp: o.data.sms_yzmnum_tmp + 1,
                    verify: "",
                    yzmbtnFlag: "djs",
                  }))
                : ((a.this = o), (a.url = "no"), e.sorry(a));
          },
        }))
      : wx.showToast({
          title: "请输入正确的【手机号】",
          icon: "none",
          mask: !0,
        });
  },
  yzmtimeFn2: function (a) {
    var t = this;
    0 != a
      ? (t.setData({ countdown: a }),
        a--,
        setTimeout(function () {
          t.yzmtimeFn2(a);
        }, 1e3))
      : t.setData({ yzmbtnFlag: "reset" });
  },
  form_MobMaskWinFn: function (s) {
    var o = s.detail.value.mob,
      d = s.detail.value.verify,
      n = this;
    i.empty(o)
      ? wx.showToast({ title: "请输入【手机号】", icon: "none", mask: !0 })
      : i.ifmob(o)
      ? i.empty(d)
        ? wx.showToast({ title: "请输入【验证码】", icon: "none", mask: !0 })
        : ((a = wx.getStorageSync("COOK_U")),
          i.ajax({
            url: "form.php",
            data: {
              submitok: "verify_chk",
              mob: o,
              verify: d,
              openid: a.openid,
              fid: n.data.fid,
            },
            success: function (a) {
              var i;
              1 == a.flag
                ? n.setData(
                    (t((i = {}), "FORMDATA.mob", o), t(i, "div_login", !1), i)
                  )
                : ((a.this = n), (a.url = "no"), e.sorry(a));
            },
          }))
      : wx.showToast({
          title: "请输入正确的【手机号】",
          icon: "none",
          mask: !0,
        });
  },
  areaidFn: function (a) {
    var i,
      s = a.currentTarget.dataset.f,
      o = a.detail.value,
      d = a.currentTarget.dataset.idx,
      n = e.areaGetTtitle(o, this.data.areaidARR),
      r = n[0],
      c = n[1];
    this.setData(
      (t((i = {}), "FORMDATA." + s, r),
      t(i, "FORMDATA.areatitle", c),
      t(i, "D_basic[" + d + "].v", c),
      i)
    );
  },
  areaidChangeFn: function (a) {
    var t,
      i,
      s,
      o = parseInt(this.data.arealeval),
      d = a.detail.column,
      n = a.detail.value,
      r =
        (a.currentTarget.dataset.idx,
        a.currentTarget.dataset.ifmate,
        {
          areaidARRDEF: this.data.areaidARRDEF,
          areaidIdx: this.data.areaidIdx,
        }),
      c = this.data.areaidARR.ARR1,
      u = this.data.areaidARR.ARR2,
      f = this.data.areaidARR.ARR3,
      m = this.data.areaidARR.ARR4,
      l = c,
      _ = [],
      h = [],
      x = [];
    switch (d) {
      case 0:
        switch (
          ((t = c[n].i),
          o >= 2 && (i = (_ = e.areaNEW(t, u))[0].i),
          o >= 3 && (s = (h = e.areaNEW(i, f))[0].i),
          o >= 4 && (x = e.areaNEW(s, m)),
          o)
        ) {
          case 1:
            (r.areaidARRDEF = [l]), (r.areaidIdx = [n]);
            break;
          case 2:
            (r.areaidARRDEF = [l, _]), (r.areaidIdx = [n, 0]);
            break;
          case 3:
            (r.areaidARRDEF = [l, _, h]), (r.areaidIdx = [n, 0, 0]);
            break;
          case 4:
            (r.areaidARRDEF = [l, _, h, x]), (r.areaidIdx = [n, 0, 0, 0]);
        }
        break;
      case 1:
        (t = c[r.areaidIdx[0]].i),
          o >= 2 && (i = (_ = e.areaNEW(t, u))[n].i),
          o >= 3 && (s = (h = e.areaNEW(i, f))[0].i),
          o >= 4 && (x = e.areaNEW(s, m)),
          o >= 3 && (r.areaidARRDEF[2] = h),
          o >= 4 && (r.areaidARRDEF[3] = x),
          o >= 2 && (r.areaidIdx[1] = n),
          o >= 3 && (r.areaidIdx[2] = 0),
          o >= 4 && (r.areaidIdx[3] = 0);
        break;
      case 2:
        (t = l[r.areaidIdx[0]].i),
          o >= 2 && (i = (_ = e.areaNEW(t, u))[r.areaidIdx[1]].i),
          o >= 3 && (s = (h = e.areaNEW(i, f))[n].i),
          o >= 4 && (x = e.areaNEW(s, m)),
          o >= 4 && (r.areaidARRDEF[3] = x),
          o >= 3 && (r.areaidIdx[2] = n),
          o >= 4 && (r.areaidIdx[3] = 0);
        break;
      case 3:
        o >= 4 && (r.areaidIdx[3] = n);
    }
    this.setData(r);
  },
  areaidFn_mate: function (a) {
    for (
      var o = a.currentTarget.dataset.kind,
        d = a.currentTarget.dataset.f,
        n = a.detail.value,
        r = a.currentTarget.dataset.idx,
        c = [],
        u = 0;
      u < n.length;
      u++
    )
      n[u] > 0 && c.push(n[u] - 1);
    if (((n = c), "hj" == o)) var f = e.areaGetTtitle(n, this.data.area2idARR);
    else f = e.areaGetTtitle(n, this.data.areaidARR);
    var m = f[0],
      l = f[1],
      _ = i.empty(l) ? "不限" : l;
    if ("hj" == o) {
      var h,
        x = "areatitle2";
      this.setData(
        (t((h = {}), "FORMDATA_MATE." + s + d, m),
        t(h, "FORMDATA_MATE." + s + x, l),
        t(h, "D_mate[" + r + "].v", _),
        h)
      );
    } else {
      var R;
      x = "areatitle";
      this.setData(
        (t((R = {}), "FORMDATA_MATE." + s + d, m),
        t(R, "FORMDATA_MATE." + s + x, l),
        t(R, "D_mate[" + r + "].v", _),
        R)
      );
    }
  },
  areaidChangeFn_mate: function (a) {
    var i,
      s = a.currentTarget.dataset.kind,
      o = "hj" == s ? 4 : parseInt(this.data.arealeval),
      d = a.detail.column,
      n = a.detail.value,
      r = a.currentTarget.dataset.idx,
      c = { def: this.data.D_mate[r].def, idx: this.data.D_mate[r].idx };
    if ("hj" == s)
      var u = this.data.area2idARR.ARR1,
        f = this.data.area2idARR.ARR2,
        m = this.data.area2idARR.ARR3,
        l = this.data.area2idARR.ARR4;
    else
      (u = this.data.areaidARR.ARR1),
        (f = this.data.areaidARR.ARR2),
        (m = this.data.areaidARR.ARR3),
        (l = this.data.areaidARR.ARR4);
    var _,
      h,
      x,
      R = [{ i: "0", v: "不限", f: "0" }],
      g = u,
      A = [],
      b = [],
      v = [];
    switch (((g = R.concat(g)), d)) {
      case 0:
        if (0 == n)
          switch (
            ((c.def[0] = g),
            o >= 2 && (c.def[1] = R),
            o >= 3 && (c.def[2] = R),
            o >= 4 && (c.def[3] = R),
            o)
          ) {
            case 1:
              c.idx = [0];
              break;
            case 2:
              c.idx = [0, 0];
              break;
            case 3:
              c.idx = [0, 0, 0];
              break;
            case 4:
              c.idx = [0, 0, 0, 0];
          }
        else
          switch (((_ = u[n - 1].i), o)) {
            case 1:
              (c.def = [g]), (c.idx = [n]);
              break;
            case 2:
              (A = R.concat(e.areaNEW(_, f))),
                (c.def = [g, A]),
                (c.idx = [n, 0]);
              break;
            case 3:
              (A = R.concat(e.areaNEW(_, f))),
                (c.def = [g, A, R]),
                (c.idx = [n, 0, 0]);
              break;
            case 4:
              (A = R.concat(e.areaNEW(_, f))),
                (c.def = [g, A, R, R]),
                (c.idx = [n, 0, 0, 0]);
          }
        break;
      case 1:
        if (0 == n)
          o >= 3 && (c.def[2] = R),
            o >= 4 && (c.def[3] = R),
            o >= 2 && (c.idx[1] = n),
            o >= 3 && (c.idx[2] = 0),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 2:
              c.idx[1] = n;
              break;
            case 3:
              (_ = u[c.idx[0] - 1].i),
                (h = (A = R.concat(e.areaNEW(_, f)))[n].i),
                (b = R.concat(e.areaNEW(h, m))),
                (c.def[2] = b),
                (c.idx[1] = n),
                (c.idx[2] = 0);
              break;
            case 4:
              (_ = u[c.idx[0] - 1].i),
                (h = (A = R.concat(e.areaNEW(_, f)))[n].i),
                (b = R.concat(e.areaNEW(h, m))),
                (c.def[2] = b),
                (c.def[3] = R),
                (c.idx[1] = n),
                (c.idx[2] = 0),
                (c.idx[3] = 0);
          }
        break;
      case 2:
        if (0 == n)
          o >= 4 && (c.def[3] = R),
            o >= 3 && (c.idx[2] = n),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 3:
              c.idx[2] = n;
              break;
            case 4:
              (_ = u[c.idx[0] - 1].i),
                (h = (A = R.concat(e.areaNEW(_, f)))[c.idx[1]].i),
                (x = (b = R.concat(e.areaNEW(h, m)))[n].i),
                (v = R.concat(e.areaNEW(x, l))),
                (c.def[3] = v),
                (c.idx[2] = n),
                (c.idx[3] = 0);
          }
        break;
      case 3:
        o >= 4 && (c.idx[3] = n);
    }
    this.setData(
      (t((i = {}), "D_mate[" + r + "].def", c.def),
      t(i, "D_mate[" + r + "].idx", c.idx),
      i)
    );
  },
  area2idFn: function (a) {
    var i,
      s = a.currentTarget.dataset.f,
      o = a.detail.value,
      d = a.currentTarget.dataset.idx,
      n = e.areaGetTtitle(o, this.data.area2idARR),
      r = n[0],
      c = n[1];
    this.setData(
      (t((i = {}), "FORMDATA." + s, r),
      t(i, "FORMDATA.area2title", c),
      t(i, "D_basic[" + d + "].v", c),
      i)
    );
  },
  area2idChangeFn: function (a) {
    var t,
      i,
      s,
      o = a.detail.column,
      d = a.detail.value,
      n =
        (a.currentTarget.dataset.idx,
        {
          area2idARRDEF: this.data.area2idARRDEF,
          area2idIdx: this.data.area2idIdx,
        }),
      r = this.data.area2idARR.ARR1,
      c = this.data.area2idARR.ARR2,
      u = this.data.area2idARR.ARR3,
      f = this.data.area2idARR.ARR4,
      m = r,
      l = [],
      _ = [],
      h = [];
    switch (o) {
      case 0:
        (t = r[d].i),
          (i = (l = e.areaNEW(t, c))[0].i),
          (s = (_ = e.areaNEW(i, u))[0].i),
          (h = e.areaNEW(s, f)),
          (n.area2idARRDEF = [m, l, _, h]),
          (n.area2idIdx = [d, 0, 0, 0]);
        break;
      case 1:
        (t = r[n.area2idIdx[0]].i),
          (i = (l = e.areaNEW(t, c))[d].i),
          (s = (_ = e.areaNEW(i, u))[0].i),
          (h = e.areaNEW(s, f)),
          (n.area2idARRDEF[2] = _),
          (n.area2idARRDEF[3] = h),
          (n.area2idIdx[1] = d),
          (n.area2idIdx[2] = 0),
          (n.area2idIdx[3] = 0);
        break;
      case 2:
        (t = m[n.area2idIdx[0]].i),
          (i = (l = e.areaNEW(t, c))[n.area2idIdx[1]].i),
          (s = (_ = e.areaNEW(i, u))[d].i),
          (h = e.areaNEW(s, f)),
          (n.area2idARRDEF[3] = h),
          (n.area2idIdx[2] = d),
          (n.area2idIdx[3] = 0);
        break;
      case 3:
        n.area2idIdx[3] = d;
    }
    this.setData(n);
  },
  btn5Fn: function (s) {
    var o = this;
    a = wx.getStorageSync("COOK_U");
    var d = JSON.stringify(o.data.FORMDATA),
      n = JSON.stringify(o.data.FORMDATA_MATE);
    i.ajax({
      url: "form.php",
      data: {
        submitok: "add_chk",
        FORMDATA: d,
        FORMDATA_MATE: n,
        fid: o.data.fid,
        openid: a.openid,
      },
      success: function (s) {
        1 == s.flag
          ? (function () {
              var s = o.data.PARR.length;
              if (s > 0) {
                var r = Array(),
                  c = 0;
                !(function u() {
                  wx.showLoading({
                    title: "上传第" + parseInt(c + 1) + "张",
                    mask: !0,
                  }),
                    wx.uploadFile({
                      url: i.WWW + "/api/wxxcx/form.php",
                      filePath: o.data.PARR[c],
                      name: "pic",
                      formData: {
                        submitok: "photo_s_uppic",
                        fid: o.data.fid,
                        openid: a.openid,
                      },
                      success: function (f) {
                        if (1 == (f = e.jsoneval(f.data)).flag)
                          if ((c++, r.push(f._s), c < s))
                            setTimeout(function () {
                              u();
                            }, 300);
                          else {
                            wx.hideLoading();
                            var m = r.join(",");
                            o.setData(t({}, "FORMDATA.photo_s", m)),
                              (d = JSON.stringify(o.data.FORMDATA)),
                              i.ajax({
                                url: "form.php",
                                data: {
                                  submitok: "add_update",
                                  FORMDATA: d,
                                  FORMDATA_MATE: n,
                                  form_agree_reg: o.data.form_agree_reg,
                                  form_agree_wxshare: o.data.form_agree_wxshare,
                                  fid: o.data.fid,
                                  openid: a.openid,
                                  tguid: o.data.tguid,
                                  admid: o.data.admid,
                                },
                                success: function (a) {
                                  1 == a.flag
                                    ? (wx.hideLoading(),
                                      wx.showToast({
                                        title: a.msg,
                                        mask: !0,
                                        duration: 3e3,
                                      }),
                                      setTimeout(function () {
                                        wx.redirectTo({
                                          url: "form_detail?fid=" + o.data.fid,
                                        });
                                      }, 3e3))
                                    : (o.setData(t({}, "D.ifbmed", 0)),
                                      wx.showToast({
                                        title: a.msg,
                                        icon: "none",
                                        mask: !0,
                                      }));
                                },
                              });
                          }
                        else
                          wx.showModal({
                            content: f.msg,
                            confirmColor: o.data.color,
                            confirmText: "朕知道了",
                            showCancel: !1,
                            success: function (a) {
                              wx.navigateBack();
                            },
                          });
                      },
                    });
                })();
              } else
                i.ajax({
                  url: "form.php",
                  data: {
                    submitok: "add_update",
                    FORMDATA: d,
                    FORMDATA_MATE: n,
                    form_agree_reg: o.data.form_agree_reg,
                    form_agree_wxshare: o.data.form_agree_wxshare,
                    fid: o.data.fid,
                    openid: a.openid,
                    tguid: o.data.tguid,
                    admid: o.data.admid,
                  },
                  success: function (a) {
                    1 == a.flag
                      ? (wx.hideLoading(),
                        wx.showToast({ title: a.msg, mask: !0, duration: 3e3 }),
                        setTimeout(function () {
                          wx.redirectTo({
                            url: "form_detail?fid=" + o.data.fid,
                          });
                        }, 3e3))
                      : (o.setData(t({}, "D.ifbmed", 0)),
                        wx.showToast({ title: a.msg, icon: "none", mask: !0 }));
                  },
                });
            })()
          : (o.setData(t({}, "D.ifbmed", 0)),
            wx.showToast({ title: s.msg, icon: "none", mask: !0 }));
      },
    });
  },
  upFn: function () {
    var a = this,
      e = 5 - parseInt(this.data.PARR.length);
    e <= 0
      ? wx.showToast({ title: "最多上传5张图片哦", icon: "none", mask: !0 })
      : wx.chooseMedia({
          count: e,
          mediaType: ["image"],
          sizeType: ["compressed"],
          sourceType: ["album", "camera"],
          success: function (e) {
            for (
              var i = a.data.PARR, s = [], o = 0;
              o < e.tempFiles.length;
              o++
            )
              s.push(e.tempFiles[o].tempFilePath);
            i = i.concat(s);
            a.setData(t({ PARR: i }, "FORMDATA.photo_s", i.join(",")));
          },
        });
  },
  delFn: function (a) {
    var t = a.currentTarget.dataset.url,
      i = e.json_remove(this.data.PARR, t);
    this.setData({ PARR: i });
  },
  kefuFn: function () {
    this.setData({ kefushow: !0 });
  },
  kefu_closeFn: function () {
    this.setData({ kefushow: !1 });
  },
  onShareAppMessage: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/form/form_detail?fid=" + this.data.fid,
    };
  },
  onShareTimeline: function () {
    var a;
    return (
      (a = {
        imageUrl: this.data.SHARE.imgurl,
        title: this.data.SHARE.title,
        query: "",
      }),
      t(a, "query", "fid=" + this.data.fid),
      t(a, "path", "/pages/form/form_detail"),
      a
    );
  },
  privacy_agree: function (a) {
    console.log("agree");
  },
  privacy_disagree: function (a) {
    console.log("disagree"), wx.exitMiniProgram();
  },
});
